package com.payment.transactions.enums;

/**
 * 支付平台枚举
 */
public enum PaymentPlatform {
    WECHAT(1, "微信"),
    ALIPAY(2, "支付宝");

    private final Integer code;
    private final String description;

    PaymentPlatform(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    public Integer getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static PaymentPlatform fromCode(Integer code) {
        for (PaymentPlatform platform : PaymentPlatform.values()) {
            if (platform.code.equals(code)) {
                return platform;
            }
        }
        return null;
    }
}
